package KC.db;

import java.sql.Connection;
import java.sql.Driver;
import java.sql.DriverManager;

public class Database {
  private static String SERVER = "@SERVER";
  private static String PORT = "@PORT";
  private static String DB = "@DB";

  private static String str_driver = "com.inet.tds.TdsDriver";
  private static String str_coneccion = "jdbc:inetdae7:"+SERVER+":"+PORT+"?database="+DB;
  public static Connection getConnection(String str_server, int int_port, String str_db, String str_username, String str_pass)throws Exception{
    Connection conn_retVal = null;
    Driver DriverRs = (Driver)Class.forName(str_driver).newInstance();
    conn_retVal = DriverManager.getConnection(str_coneccion.replaceAll(SERVER, str_server).replaceAll(PORT, ""+int_port).replaceAll(DB, str_db),str_username,str_pass);
    return conn_retVal;
  }
}
